/**
 * OSAmI: Open Source Ambient Intelligence
 * Copyright (C) 2010 Bull S.A.S.
 * Contact: osami-general@osami-commons.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 */

package org.osami.gateway.profile.luminosity;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

/**
 * A {@code LuminosityProfile} is ...
 *
 * @author Guillaume Sauthier
 */
public class LuminosityProfile {

    private static final double DEFAULT_BOTTOM_VALUE = 885;
    private static final double DEFAULT_TOP_VALUE = 915;

    private final PropertyChangeSupport changes = new PropertyChangeSupport(this);

    /**
     * The bottomValue threshold.
     */
    private double bottomValue = DEFAULT_BOTTOM_VALUE;

    /**
     * The topValue threshold.
     */
    private double topValue = DEFAULT_TOP_VALUE;

    /**
     * The ID of the plug that this rule acts on.
     */
    private String plugId = null;

    public double getBottomValue() {
        return bottomValue;
    }

    public void setBottomValue(double bottomValue) {
        double oldTemperature = this.bottomValue;
        this.bottomValue = bottomValue;
        this.changes.firePropertyChange("bottomValue", oldTemperature, bottomValue);
    }

    public double getTopValue() {
        return topValue;
    }

    public void setTopValue(double topValue) {
        double oldTop = this.topValue;
        this.topValue = topValue;
        this.changes.firePropertyChange("topValue", oldTop, topValue);
    }

    public String getPlugId() {
        return plugId;
    }

    public void setPlugId(String plugId) {
        String old = this.plugId;
        this.plugId = plugId;
        this.changes.firePropertyChange("plugId", old, plugId);
    }

    public void addPropertyChangeListener(final PropertyChangeListener l) {
        this.changes.addPropertyChangeListener( l );
    }

    public void removePropertyChangeListener(final PropertyChangeListener l) {
        this.changes.removePropertyChangeListener( l );
    }

}
